#include "junix.h"
using namespace std;

int main(int argc, char **argv)
{
	const int sz = 30;
	vector<int> V(sz);
	generate(V.begin(),V.end(),boost::bind(modulus<int>(),
				boost::bind(rand), sz));
	copy(V.begin(), 
			partition(V.begin(), V.end(),bind2nd(less<int>(), sz/2)),
			ostream_iterator<int>(cout," "));
	cout<<endl;

	copy( V.begin(),
		  partition(V.begin(),V.end(), 
			        boost::bind(equal_to<int>(),
						boost::bind(modulus<int>(), _1, 2), 0)),
		  ostream_iterator<int>(cout," "));
	cout<<endl;
}
